

import requests  # 导入requests包
from bs4 import BeautifulSoup

url = 'http://datachart.500.com/ssq/history/newinc/history.php?start=03001&end=03100'
strhtml = requests.get(url)
#print(strhtml.text)
#soup = BeautifulSoup(strhtml.text, 'lxml')
soup = BeautifulSoup(strhtml.text,'lxml')
tbody = soup.find(id='tdata')
#print(type(tbody))
#print(tbody)

trs = tbody.find_all('tr')
print(len(trs))
print(trs)

#tds

for tr in trs:
    for td in tr.find_all('td'):
        print(td.string),
